   set nocompatible              " be iMproved, required
   filetype off                  " required

   " set the runtime path to include Vundle and initialize
   set rtp+=~/.vim/bundle/Vundle.vim
   call vundle#begin()
   " alternatively, pass a path where Vundle should install plugins
   "call vundle#begin('~/some/path/here')

   " let Vundle manage Vundle, required
   Plugin 'VundleVim/Vundle.vim'

   " The following are examples of different formats supported.
   " Keep Plugin commands between vundle#begin/end.
   " plugin on GitHub repo
   "Plugin 'tpope/vim-fugitive'
   Plugin 'scrooloose/nerdtree'
   Plugin 'Valloric/YouCompleteMe'
   "Plugin 'tenfyzhong/CompleteParameter.vim'
   "Plugin 'vim-scripts/gdbmgr'
   "Plugin 'tmhedberg/SimpylFold'
   "Plugin 'vim-scripts/VimIM'
   Plugin 'fatih/vim-go'
   Plugin 'vim-airline/vim-airline'
   ""Plugin 'itchyny/lightline.vim'
   Plugin 'junegunn/goyo.vim'
   Plugin 'vim-airline/vim-airline-themes'
   Plugin 'ctrlpvim/ctrlp.vim'
   Plugin 'tpope/vim-fugitive'
   Plugin 'buoto/gotests-vim'
   ""Plugin 'dkprice/vim-easygrep'
   "Plugin 'suan/vim-instant-markdown'
   " Plugin 'git@github.com:aperezdc/vim-template.git'
   " plugin from http://vim-scripts.org/vim/scripts.html
   " Plugin 'L9'
   " Git plugin not hosted on GitHub
   ""Plugin 'git://git.wincent.com/command-t.git'
   " git repos on your local machine (i.e. when working on your own plugin)
   "Plugin 'file:///home/gmarik/path/to/plugin'
   "Plugin 'file:///home/sunriz/.vim/bundle/YouCompleteMe' 
   " The sparkup vim script is in a subdirectory of this repo called vim.
   " Pass the path to set the runtimepath properly.
   ""Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
   " Install L9 and avoid a Naming conflict if you've already installed a
   " different version somewhere else.
   ""Plugin 'ascenator/L9', {'name': 'newL9'}

   " All of your Plugins must be added before the following line
   call vundle#end()            " required
   filetype plugin indent on    " required
   " To ignore plugin indent changes, instead use:
   "filetype plugin on
   "
   " Brief help
   " :PluginList       - lists configured plugins
   " :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
   " :PluginSearch foo - searches for foo; append `!` to refresh local cache
   " :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
   "
   " see :h vundle for more details or wiki for FAQ
   " Put your non-Plugin stuff after this line

filetype on
syntax enable

set autoindent
set shiftwidth=4
set tabstop=4
set expandtab
set smarttab
set softtabstop=4
set cindent
set nu
set ruler

set background=dark
colorscheme molokai

""imap ` <ESC>A
imap <C-`> `
imap [ []<ESC>i
imap { {}<ESC>i
imap ( ()<ESC>i

inoremap " ""<ESC>i<ESC>a
    "非递归map
    imap <C-a> <ESC>A<CR>
    " 中间换行
imap <F12> <ESC>:wq<CR>
nmap <F12> :wq<CR>

imap <C-j> <ESC>i
imap <C-l> <ESC>la
nmap <C-=> <C-W>+
nmap <C--> <C-W>-

""move
nmap <C-h> <C-w>h
nmap <C-l> <C-w>l
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k


let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'
let g:ycm_python_binary_path = '$HOME/.local/bin/python3'
let g:ycm_autoclose_preview_window_after_completion=1

filetype plugin on

map <C-n> :NERDTreeToggle<CR>

nmap <silent> <F8> <Plug>MarkdownPreview        " for normal mode
imap <silent> <F8> <Plug>MarkdownPreview        " for insert mode
nmap <silent> <F9> <Plug>StopMarkdownPreview    " for normal mode
imap <silent> <F9> <Plug>StopMarkdownPreview    " for insert mode

""" complate_parameter mini settings
""inoremap <silent><expr> ( complete_parameter#pre_complete("()")
""smap <c-j> <Plug>(complete_parameter#goto_next_parameter)
""imap <c-j> <Plug>(complete_parameter#goto_next_parameter)
""smap <c-k> <Plug>(complete_parameter#goto_previous_parameter)
""imap <c-k> <Plug>(complete_parameter#goto_previous_parameter)

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Quickly Run
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

map <F5> :call CompileRunGcc()<CR>

func! CompileRunGcc()
    exec "w"
    if &filetype == 'c'
        exec '!echo ----------------------------------------'
        exec '!g++ % -o %<'
        exec '! ./%<'
    elseif &filetype == 'cpp'
        exec '!echo ----------------------------------------'
        exec '!g++ % -o %<'
        exec '! ./%<'
    elseif &filetype == 'python'
        exec '!python %<.py'
    elseif &filetype == 'sh'
        :!time bash %
    endif
endfunc 

 set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
 set termencoding=utf-8
 set encoding=utf-8
 set textwidth=75

 set cursorline "突出显示当前行
 set nobackup "禁止备份文件
 set noswapfile "禁止交换文件
 set autochdir "自动切换工作目录为当前目录"
 set backspace=indent,eol,start "修复退格键无法使用的问题
 set hlsearch

 autocmd BufNewFile *.cpp 0r ~/.vim/templates/template.cpp
 "autocmd FileType c,cpp imap ` <ESC>A;<CR>
 autocmd FileType c,cpp imap { {<CR>}<ESC>O
 
 " golint
 ""set rtp+=$GOPATH/src/golang.org/x/lint/misc/vim
 ""autocmd BufWritePost,FileWritePost *.go execute 'Lint' | cwindow  

 "buffer config"
 set hidden
 nmap - :bprevious<CR>
 nmap = :bnext<CR>

""tab config
set laststatus=2
nmap <C-c> :tabclose<CR>
nmap _ :tabprevious<CR>
nmap + :tabnext<CR>

let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
    let g:airline_symbols = {}
  endif

  " unicode symbols
  let g:airline_left_sep = '▶'
  let g:airline_right_sep = '◀'
  let g:airline_symbols.crypt = '🔒'
  let g:airline_symbols.linenr = '☰'
  let g:airline_symbols.spell = 'Ꞩ'
  let g:airline_symbols.notexists = 'Ɇ'
  let g:airline_symbols.whitespace = 'Ξ'

let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
""let g:airline_theme='luna'
let g:airline_theme='random'
""let g:airline_theme='zenburn'


""Goyo
nmap <C-z> :Goyo<CR>

""nerdtree
"close vim
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

